package com.inspur.dgov.bsp.system.vo;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.inspur.dgov.bsp.system.entity.PubDict;
import com.inspur.dgov.common.tool.node.INode;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.ArrayList;
import java.util.List;

/**
 * 列表展示字典对象
 *
 * @Author chiyupei
 * @Date 20/3/20 下午10:56
 * @Version 1.0
 * @Description 列表展示字典对象
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "DictVO对象", description = "DictVO对象")
public class DictVO extends PubDict implements INode {

    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    private Long id;

    /**
     * 父节点ID
     */
    private Long parentId;

    /**
     * 子孙节点
     */
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<INode> children;

    @Override
    public List<INode> getChildren() {
        if (this.children == null) {
            this.children = new ArrayList<>();
        }
        return this.children;
    }

    /**
     * 上级字典
     */
    private String parentName;

    /**
     * 字典类别
     */
    private String configName;
}
